﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;

using LowLevelGraphics.Types.Interval;

namespace LowLevelGraphics.Types
{
    public class ColorRange
    {
        protected Color m_Color1;
        protected Color m_Color2;

        protected ByteInterval m_a = null;
        protected ByteInterval m_r = null;
        protected ByteInterval m_g = null;
        protected ByteInterval m_b = null; 

        public ColorRange(Color _color1, Color _color2)        
        {
            m_Color1 = _color1;
            m_Color2 = _color2;

            m_a = new ByteInterval(_color1.A, _color2.A);
            m_r = new ByteInterval(_color1.R, _color2.R);
            m_g = new ByteInterval(_color1.G, _color2.G);
            m_b = new ByteInterval(_color1.B, _color2.B);
        }

        public bool Contains(Color _color)
        {
            if (_color == m_Color1)
                return true;

            if (_color == m_Color2)
            {
                return true;
            }

            bool bTest = m_a.Contains(_color.A) && m_r.Contains(_color.B) && m_g.Contains(_color.G) && m_b.Contains(_color.B);
            return bTest;
        }

        public bool Contains(ByteInterval _byteInterval)
        {
            return Contains(_byteInterval, true);
        }

        public bool Contains(ByteInterval _byteInterval, bool _bVertical)
        {
            return false;
        }

        public ByteInterval A
        {
            get { return m_a; }
            set { m_a = value; }
        }

        public ByteInterval R
        {
            get { return m_r; }
            set { m_r = value; }
        }

        public ByteInterval G
        {
            get { return m_g; }
            set { m_g = value; }
        }

        public ByteInterval B
        {
            get { return m_b; }
            set { m_b = value; }
        }
    }
}
